package com.wujing.fun.first3demo


/**
 * 抛出自定义的异常
 *
 */
object ThrowDemo {

  def test(): Nothing = {
    throw new Exception("exception !!!!")
  }


  @throws(classOf[NumberFormatException])
  def test2() = {
    println("hello")
  }

  def main(args: Array[String]): Unit = {
//    test()


    try {
      test()
    }catch {
      case exception: Exception=>println("ex"+exception)
    }finally {
      println("ok~~ ")
    }
  }

}
